<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>评论-闲言轻博客</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	{{template "/comn/link.html"}}
</head>
<body class="lay-blog">
{{template "/comn/header.html" .}}
		<div class="container-wrap">
			<div class="container container-message container-details container-comment">
					<div class="contar-wrap">
						<div class="item">
							{{template "comn/note_summary.html" .note}}
						</div>	
						<form class="layui-form" action="">
							<input type="hidden" name="key" value="{{.note.Key}}">
							<div class="layui-form-item layui-form-text">
								<textarea  class="layui-textarea" name="content" style="resize:none" placeholder="写点什么啊"></textarea>
							</div>
							<div class="btnbox">
									<a type="submit" lay-submit lay-filter="comment">
							  		确定
							  	</a>
							</div>
						</form>
					</div>
			</div>
		</div>
{{template "comn/footer.html"}}
	<script>
	layui.use(['form', 'jquery', 'layer'], function(){
		var $ = layui.$
				,form = layui.form
				,layer = layui.layer
				,router = layui.router();

		form.render();

		//提交
		form.on('submit(comment)', function(obj){
			$.post("/message/new/"+obj.field.key,{content:obj.field.content},function (data) {
				if(data.code==0){
					layer.msg('评论成功');
						setTimeout(function () {
							window.location.href="/details/"+obj.field.key
						},300)
				}else{
					layer.msg(data.msg);
				}
			},"json").error(function () {
				layer.msg('网络延迟');
			})
			return false

		});


	});
</script>
		{{/*
	<script id="LAY-msg-tpl" type="text/html">
		<div class="info-box">
			<div class="info-item">
				<img class="info-img" src="{{ d.avatar }}" alt="">
			  <div class="info-text">
					<p class="title">
					  <span class="name">{{ d.username }}</span>
					  <span class="info-img">
					  	<i class="layui-icon layui-icon-praise"></i>
					  	{{ d.praise }}
					 	</span>
					</p>
					<p class="info-intr">
						{{ d.content }}
					</p>
			  </div>
			</div>
		</div>
	</script>*/}}
</body>
</html>